package com.hwz.controller.user;

import com.hwz.entity.Category;
import com.hwz.result.Result;
import com.hwz.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * [一句话描述该类的功能]
 *
 * @author : [Lenovo]
 * @version : [v1.0]
 * @createTime : [2024/3/18 16:41]
 */
@RestController("UserCategoryController")
@RequestMapping("/user/category")
@Slf4j
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("/list")
    public Result<List<Category>> getCategory(Integer type){
        log.info("查询分类type:{}",type);
        List<Category> categories = categoryService.list(type);
        return  Result.success(categories);
    }
}
